package logic

import (
	"context"
	"regist-detail-sys/model/mysql"

	"regist-detail-sys/registrpc/internal/svc"
	"regist-detail-sys/registrpc/registrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type RegisDelLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewRegisDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RegisDelLogic {
	return &RegisDelLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 挂号删除
func (l *RegisDelLogic) RegisDel(in *registrpc.RegisDelRequest) (*registrpc.RegisDelResponse, error) {
	// todo: add your logic here and delete this line

	var patient mysql.Patient

	err := patient.PatientDel(mysql.DB, in.PatientId)
	if err != nil {
		return nil, err
	}

	return &registrpc.RegisDelResponse{}, nil
}
